<!--
  ~ Copyright 2022 Red Hat, Inc. and/or its affiliates.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <title>Newsletter Subscription Application</title>
    <link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
</head>
<body>
<div class="container-fluid">
    <div class="sticky-top d-flex justify-content-center align-items-center" aria-live="polite" aria-atomic="true">
        <div id="notificationPanel" style="position: absolute; top: .5rem;"></div>
    </div>
    <h1>Newsletter Subscription Application</h1>

    <p>Use the 'Refresh' button to update the grids below.</p>

    <div style="margin-bottom: .5rem">
        <button id="refreshButton" type="button" class="btn btn-success">
            <span class="fas fa-sync"></span> Refresh
        </button>
        <button id="newSubscription" type="button" class="btn btn-primary">
            <span class="fas fa-play"></span> New Subscription
        </button>
    </div>

    <h2>Pending Subscriptions</h2>
    <table class="table table-borderless table-striped" id="pendingSubscriptions">
        <!-- Filled in by app.js -->
    </table>

    <div class="modal fade" id="newSubscriptionForm" tabindex="-1" aria-labelledby="NewSubscriptionFormLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="NewSubscriptionFormLabel">Add a new subscription</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form>
                        <div class="form-group">
                            <label for="txtName" class="col-form-label">Name:</label>
                            <input class="form-control" id="txtName" type="text"/>
                            <label for="txtEmail" class="col-form-label">Email:</label>
                            <input class="form-control" id="txtEmail" type="email"/>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="newSubscription()">New Subscription</button>
                </div>
            </div>
        </div>
    </div>

    <div id="spinnerDialog" class="modal" tabIndex="-1" data-bs-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="d-flex align-items-center">
                        <div class="spinner-border" role="status"></div>
                        <span id="spinnerDialogMessage" style="padding-left: 15px">Loading ...</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/webjars/jquery/jquery.min.js"></script>
<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
<script src="/app.js"></script>

</body>
</html>